<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
  </head>

  <body>
    <!--导入SDK文件-->
    <img src="https://zddsc.oss-cn-beijing.aliyuncs.com/xianyu22.jpg?OSSAccessKeyId=LTAI5tBWSfGYWw9cveErF9iU&Expires=1723443963&Signature=g%2FjjOYqx2koySfIpcC5ZMsf2J0E%3D&response-content-disposition=attachment%3B%20filename%3Dxianyu22.jpg">
    <script
      type="text/javascript"
      src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.18.0.min.js"
    ></script>
    <script type="text/javascript">
      const client = new OSS({
        // yourRegion填写Bucket所在地域。以华东1（杭州）为例，Region填写为oss-cn-hangzhou。
        region: "oss-cn-beijing",
        // 从STS服务获取的临时访问密钥（AccessKey ID和AccessKey Secret）。
        accessKeyId: "STS.NTPemVmCZEWcTGuxZQqdGwPFy",
        accessKeySecret: "CGtupoTrJwrGt6i2cewoaj1jgbmLU4qjy3BvVL8WjCLC",
        // 从STS服务获取的安全令牌（SecurityToken）。
        stsToken:"CAIS4QJ1q6Ft5B2yfSjIr5flLtfigJx78pWIVmHEnFoEfetrmJXtmzz2IHhMeXFgCe4YtPw/n2BV6/oTlrJaT55UWErjVvBM6Zda9yysZYfbstCy94YDjJD9qtQnqeOhjqHoeOzcYI73WJXEMiLp9EJaxb/9ak/RPTiMOoGIjphKd8keWhLCAxNNGNZRIHkJyqZYTwyzU8ygKRn3mGHdIVN1sw5n8wNF5L+439eX52i17jS46JdM/NmvfMH7P5k9Yc4mCY3s5oEsKPqdihw3wgNR6aJ7gJZD/Tr6pdyHCzFTmU7ea7eMoo0xclUhNvNqRvMY/eKPnPl5q/HVkJ/s1xFOMOdaXiLSXom8x9HeH+ekJgu/hGVw6ainOLmuQXqV22tMCRpzXIj6bsWg675eIyiNW+P7616WCUFLWH3Xb4Kv/s94L2QLAbsWU6TEKRaB7Ut3s0I6fqtYRSdOk3bg0S9LL8duGxqAATzic+RPa59qb1XJ05chIW7onOB6VaXQzE45iBC+f5ZLMJSPhboCrUWs7C13Zeb8jQN/YEKZvMhazPfgQDJ2yomeGCQQQTBSwQNrouUcoky2F9ZEW0nZEKdYTZSVeFo3P33uuZCR4hlGUsgGn3X1PsaCoh0ypua55WzwkYP51wM8IAA=",
        // 填写Bucket名称。
        bucket: "zddsc",
      });

      // 配置响应头实现通过URL访问时自动下载文件，并设置下载后的文件名。
      const filename = "xianyu22.jpg";
      const response = {
        "content-disposition": `attachment; filename=${encodeURIComponent(
          filename
        )}`,
      };
      // 填写Object完整路径。Object完整路径中不能包含Bucket名称。
      const url = client.signatureUrl("xianyu22.jpg", { response });
      console.log(url);
    </script>
  </body>
</html>